[DeviceSanitizer] Fix interceptor destruction order#1879
[DeviceSanitizer] Fix interceptor destruction order#1879omarahmed1111 merged 15 commits intooneapi-src:mainfrom
Conversation
pbalcer
left a comment
There was a problem hiding this comment.
This bit us a couple of times now. Can you please add some tests in UR to verify that the sanitizer at least initializes, parses options and destroys correctly.
Our CI infra now has PVC systems (the label is "L0_E2E"), so you could even add tests for the core functionality, but for now it would be good to cover just the general init/teardown flow.
| if (result == UR_RESULT_SUCCESS) { | ||
| const uint32_t NumAdapters = pNumAdapters ? *pNumAdapters : NumEntries; | ||
| for (uint32_t i = 0; i < NumAdapters; ++i) { | ||
| UR_CALL(getContext()->interceptor->holdAdapter(phAdapters[i])); |
There was a problem hiding this comment.
If urAdapterGet() get called multiple times, then we would have duplicated handles.
There was a problem hiding this comment.
maybe we needn't hold the handle of adapter, it seems ur loader has already hold this.
I'll investigate this.
There was a problem hiding this comment.
every time you call urAdapterGet, an internal reference count is incremented and you need to decrement it using urAdapterRelease.
Sorry for the delay! I will add some tests in this PR. |
|
unified-runtime/source/loader/ur_lib.hpp
I had found where this logic is. |
Makes sense, please feel free to do that change. |
|
@pbalcer I think this fix is also needed for our next release, can you help to add a label for it? |
|
LLVM test: intel/llvm#14963 |
|
@AllanZyne at this point things will need to be cherry-picked into the release branch, https://github.com/oneapi-src/unified-runtime/tree/v0.10.x. No need to do that now though. Just make sure all the PRs that you want included are tagged with |
Ok, thanks for your information. I've checked CI tests in UR and LLVM, it seems they're unrelated to this PR. |
yingcong-wu
left a comment
There was a problem hiding this comment.
LGTM other than a commenting problem.
|
Hi @oneapi-src/unified-runtime-maintain, since this PR is an essential bugfix for next release, can you help to review and merge this PR ASAP? |
aarongreig
left a comment
There was a problem hiding this comment.
LGTM pending comments
|
Hi @oneapi-src/unified-runtime-maintain, should I cherry pick this PR by myself? |
The bump for this was included in intel/llvm#15101 which is already on our list to cherry-pick |
[DeviceSanitizer] Fix interceptor destruction order
Adapters are released earlier than loader by SYCL Runtime, so we hold them in interceptor to prevent crash